/*
 * SRM 187 Div 2 Prob 3
 */


import java.util.*;
import java.util.regex.*;
import java.text.*;
import java.math.*;


public class PointInPolygon
{
    public String testPoint(String[] vertices, int testPointX, int testPointY)
    {
	int c = 0;
	int n = vertices.length ;
	
	for ( int i = 0 ; i < n ; i ++ ) {
	    int[][] x = new int[2][2];
	    for (int j = 0; j < 2; ++j)
		for (int k = 0; k < 2; ++k) 
		    x[j][k] = Integer.parseInt (vertices[(i+j)%n].split (" ")[k]);
	    
	    if (Math.max (x[0][0], x[1][0]) >= testPointX && Math.min (x[0][0], x[1][0]) <= testPointX
		&& Math.max (x[0][1], x[1][1]) >= testPointY && Math.min (x[0][1], x[1][1]) <= testPointY)
		return "BOUNDARY";
	}

	testPointX = testPointX * 2 + 1 ;
	testPointY = testPointY * 2 + 1 ;
	for ( int i = 0 ; i < n ; i ++ )
	    {
		int[][] x = new int[2][2];
		for (int j = 0; j < 2; ++j)
		    for (int k = 0; k < 2; ++k) 
			x[j][k] = 2*Integer.parseInt (vertices[(i+j)%n].split (" ")[k]);
		if (x[0][0] != x[1][0])
		    continue;
		if (Math.max (x[0][1], x[1][1]) < testPointY || Math.min (x[0][1], x[1][1]) > testPointY)
		    continue;
		if (testPointX > x[0][0])
		    c++;
	    }
	if ( c % 2 == 0 ) 
	    return "EXTERIOR" ;
	return "INTERIOR" ;
    }
    
    <%:testing-code%>
}
//Powered by KawigiEdit 2.1.4 (beta) modified by pivanof!